<?php

/**
 * Memberships form base class.
 *
 * @method Memberships getObject() Returns the current form's model object
 *
 * @package    gamerstats
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMembershipsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idmemberships' => new sfWidgetFormInputHidden(),
      'user'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => false)),
      'clan'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Clans'), 'add_empty' => false)),
      'beginning'     => new sfWidgetFormDate(),
      'ending'        => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'idmemberships' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idmemberships')), 'empty_value' => $this->getObject()->get('idmemberships'), 'required' => false)),
      'user'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Users'))),
      'clan'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Clans'))),
      'beginning'     => new sfValidatorDate(),
      'ending'        => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('memberships[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Memberships';
  }

}
